from pytracking.tracking.models import Location, Device

def get_device(params):
    if "imei" in params:
        try:
            device = Device.objects.filter(IMEI=imei).all()
        except:
            return {"Error":"Device not found."}
        
        return {'Device': device[0]}
    else:
        try:
            device = Device.objects.all()
        except:
            return {"Error":"Device not found."}

        return {'Device': device}
            
    return {'Error': "This get_device does not have Super Cow Powers."}


